﻿$(document).ready(function () {
    $(".numbersOnly").keydown(function (event) {
        // Allow only backspace, delete,tab, and period keys
        if (event.keyCode == 46 || event.keyCode == 8 || event.keyCode == 9 || event.keyCode == 190 || event.keyCode == 110) {
            // let it happen, don't do anything
        }
        else {
            // Ensure that it is a number and stop the keypress
            if ((event.keyCode < 48 || event.keyCode > 57) && (event.keyCode < 96 || event.keyCode > 105)) {
                event.preventDefault();
            }
        }
    });

    $(".lettersOnly").keydown(function (event) {
        // Allow only backspace, delete,tab, and period keys
        if (event.keyCode == 46 || event.keyCode == 8 || event.keyCode == 9 || event.keyCode == 190 || event.keyCode == 110) {
            // let it happen, don't do anything
        }
        else {
            // Ensure that it is a number and stop the keypress
            if (event.keyCode < 65 || event.keyCode > 90) {
                event.preventDefault();
            }
        }
    });
});

$(function () {
    $(".test2").keydown(function (event) {
        // Allow only backspace and delete
        if (event.keyCode == 46 || event.keyCode == 8) {
            // let it happen, don't do anything
        }
        else {
            // Ensure that it is a number and stop the keypress
            if (event.keyCode < 65 || event.keyCode > 90) {
                event.preventDefault();
            }
        }
    });
});